using System;
using System.Data;

namespace BeeldBank.Business
{
	public enum BusinessState
	{
		Unchanged = 0,
		New = 1,
		Changed = 2,
		Deleted = 3
	}
	/// <summary>
	/// Summary description for BusinessBase.
	/// </summary>
	public class BusinessBase
	{
		protected DataRow _dataRow;

		#region Constructors
		public BusinessBase()
		{
		}

		public BusinessBase(DataRow dataRow)
		{
			_dataRow = dataRow;
		}
		#endregion

		#region Clear()
		public void Clear()
		{
			this._canLoad = true;
			this._isDirty = false;
			this._state = BusinessState.Unchanged;
			this._prepareForSaveFinished = false;
		}
		#endregion

		#region Luw
		protected Luw _luw;
		public Luw Luw
		{
			get
			{
				return _luw;
			}
			set
			{
				_luw = value;
			}
		}
		#endregion

		#region PrepareForSaveFinished
		private bool _prepareForSaveFinished = false;
		public bool PrepareForSaveFinished
		{
			get
			{
				return _prepareForSaveFinished;
			}
			set
			{
				_prepareForSaveFinished = value;
			}
		}
		#endregion

		#region CanLoad
		private bool _canLoad = true;
		public bool CanLoad
		{
			get
			{
				return _canLoad;
			}
			set
			{
				_canLoad = value;
			}
		}
		#endregion

		#region State BusinessState
		private BusinessState _state = BusinessState.Unchanged;
		public BusinessState State
		{
			get
			{
				return _state;
			}
			set
			{
				if (_state == BusinessState.New && value == BusinessState.Changed)
				{
				}
				else
				{
					_state = value;
				}
				IsDirty = true;
			}
		}
		#endregion

		#region IsDirty
		private bool _isDirty = false;
		public bool IsDirty
		{
			get
			{
				return _isDirty;
			}
			set
			{
				_isDirty = value;
			}
		}
		#endregion

	}
}